package com.rc.saas.mini.service.tenant;

import com.rc.saas.mini.mapper.tenant.TenantWeixinTemplateMapper;
import com.rc.saas.mini.model.tenant.TenantWeixinTemplate;
import com.rc.saas.mini.model.tenant.TenantWeixinTemplateExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TenantWeixinTemplateServiceImpl implements TenantWeixinTemplateService {
    @Autowired
    private TenantWeixinTemplateMapper tenantWeixinTemplateMapper;

    @Override
    public TenantWeixinTemplateMapper getMapper() {
        return tenantWeixinTemplateMapper;
    }

    @Override
    public TenantWeixinTemplate selectByTemplateTitlea(String tenantCode, String msgTitle) {
        TenantWeixinTemplateExample example=new TenantWeixinTemplateExample();
        example.createCriteria().andTemplateTitleEqualTo(msgTitle).andTenantCodeEqualTo(tenantCode);
        return tenantWeixinTemplateMapper.selectByExample(example).stream().findFirst().orElseGet(()->null);
    }
}
